package com.zt.ztyh.utils;

import io.minio.MinioClient;
import io.minio.PutObjectArgs;

import java.io.FileInputStream;

public class MinioUtil {
    public static void main(String[] args)  throws Exception{
        //建立MINIO链接
        MinioClient minioClient  = MinioClient.builder()
                .endpoint("http://localhost:9000")
                .credentials("minioadmin","minioadmin")
                .build();
        //创建bucket，直接设置bucket
        //bucketName
        FileInputStream fis = new FileInputStream("d:\\aa.jpg");
        PutObjectArgs putObjectArgs = PutObjectArgs.builder().bucket("ztzx").object("1.jpg").stream(fis, 0, 0).build();

        minioClient.putObject(putObjectArgs);
    }
}
